﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title>
    <base target="_self" />
    <link href="<%=basePath %>Styles/css.css" rel="stylesheet" type="text/css" />
    <link href="<%=basePath %>Styles/ts_css.css" rel="stylesheet" type="text/css" />
    <script src="<%=basePath %>Scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="<%=basePath %>Scripts/IndexManager.js" type="text/javascript"></script>
    <script src="<%=basePath %>Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function getQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) {
                return unescape(r[2]);
            }
            return null;
        }
        function WdatePickers() {


            WdatePicker({ readOnly: true, startDate: getQueryString("date") + '-1-1', dateFmt: 'yyyy-MM-dd ' });
        }
    </script>
</head>
<body">
    <form method="post" action="insert.do" id="form1">

    <div id="divTwo">
        <table width="100%" border="0" cellpadding="2" cellspacing="2" class="table_list1">
            <tr id="selTwo">
				<td width="20%" class="table_list1_style1" height="30px">
                    <span style="color: Red">*</span> 所属项目名称
                </td>
				<td width="35%" class="table_list1_style2">
                    <select type="text" id="projectId" name="projectId" onchange="changeBuild()">
                		<option value="">-----请选择所属项目-----</option>
                		<c:forEach var="pbean" items="${plist}">
                    		<option value="${pbean.projectId}">${pbean.projectName}</option>
                    	</c:forEach>
                	</select>
                </td>
                <td width="20%" class="table_list1_style1">
                    <span style="color: Red">*</span> 所属楼栋名称
                </td>
				<td width="35%" class="table_list1_style2">
                    <select type="text" id="buildId" name="buildId" onchange="changeUnit()">
                	</select>
                </td>
			</tr>
			<tr id="selTwo">
				<td width="20%" class="table_list1_style1" height="30px">
                    <span style="color: Red">*</span> 所属单元
                </td>
				<td width="35%" class="table_list1_style2">
                    <select type="text" id="unitId" name="unitId">
                	</select>
                </td>
                <td width="20%" class="table_list1_style1">
                    <span style="color: Red">*</span> 所属户型
                </td>
				<td width="35%" class="table_list1_style2">
                    <select type="text" id="apartmentLayoutId" name="apartmentLayoutId" >
                		<option value="">-----请选择所属户型-----</option>
                		<c:forEach var="albean" items="${allist}">
                    		<option value="${albean.apartmentLayoutId}">${albean.apartmentLayout}</option>
                    	</c:forEach>
                	</select>
                </td>
			</tr>
 			<tr id="selTwo">
				<td width="20%" class="table_list1_style1" height="30px">
                    <span style="color: Red">*</span> 所属用途
                </td>
				<td width="35%" class="table_list1_style2">
                    <select type="text" id="purposeId" name="purposeId" >
                		<option value="">-----请选择所属用途-----</option>
                		<c:forEach var="ppbean" items="${pplist}">
                    		<option value="${ppbean.purposeId}">${ppbean.purpose}</option>
                    	</c:forEach>
                	</select>
                </td>
                <td width="20%" class="table_list1_style1">
                    <span style="color: Red">*</span> 所属开盘
                </td>
				<td width="35%" class="table_list1_style2">
                    <select type="text" id="openingReportId" name="openingReportId">
                	</select>
                </td>
			</tr>
			<tr id="selTwo">
				<td width="20%" class="table_list1_style1" height="30px">
                    <span style="color: Red">*</span> 房间房号
                </td>
				<td width="35%" class="table_list1_style2">
                    <input name="roomCode" type="text"  id="roomCode"  />
                </td>
                <td width="20%" class="table_list1_style1">
                    <span style="color: Red">*</span> 实际面积
                </td>
				<td width="35%" class="table_list1_style2">
                    <input name="buildUpArea" type="text"  id="buildUpArea" />
                </td>
			</tr>
			<tr id="selTwo">
				<td width="20%" class="table_list1_style1" height="30px">
                    <span style="color: Red">*</span> 可用面积
                </td>
				<td width="35%" class="table_list1_style2">
                    <input name="innerArea" type="text"  id="innerArea"  />
                </td>
                <td width="20%" class="table_list1_style1">
                    <span style="color: Red">*</span> 套内面积单价
                </td>
				<td width="35%" class="table_list1_style2">
                    <input name="innerPrice" type="text"  id="innerPrice" />
                </td>
			</tr>
			<tr id="selTwo">
				<td width="20%" class="table_list1_style1" height="30px">
                    <span style="color: Red">*</span> 建筑面积单价
                </td>
				<td width="35%" class="table_list1_style2">
                    <input name="unitPrice" type="text"  id="unitPrice" />
                </td>
                <td width="20%" class="table_list1_style1">
                    <span style="color: Red">*</span> 楼层
                </td>
				<td width="35%" class="table_list1_style2">
                    <input name="floor" type="text" id="floor" />
                </td>
			</tr>
            <tr id="isNone">
            	 <td width="20%" class="table_list1_style1" height="30px">
                    <span style="color: Red">*</span> 房间状态
                </td>
				<td width="35%" class="table_list1_style2">
                    <select type="text" id="state" name="state">
                    	<option value="">-----请选择房间状态-----</option>
                    	<option value="0">未售</option>
                    	<option value="1">已售</option>
                    	<option value="2">预定</option>
                    	<option value="3">未开盘</option>
                    	<option value="4">待审核</option>
                    	<option value="5">审核通过</option>
                	</select>
                </td>
                <td class="table_list1_style1">
                    &nbsp;
                </td>
                <td class="table_list1_style2">
                    <input type="submit" name="btnUpdate" value="添加" id="btnUpdate" class="button" />
                    &nbsp;&nbsp;
                    <input id="btnBack" type="button" class="button" value="关闭" onclick="page_Close()" />
                </td>
            </tr>
        </table>
    </div>
    <input type="hidden" name="hidUuid" id="hidUuid" value="ECF9FBAF2C90487190A279241A03E5B9" />
    </form>
    <script type="text/javascript">
    var addOption;
	function changeBuild(){
		$("#buildId").empty();
		var projectId = $("#projectId").find("option:selected").val();
		/* alert(projectId); */ 
		 $.ajax({
			url:"selectBuild.do",
			type:'post',
			data:{projectId:projectId},
			datatype: "json",
			success:function(data){
				for ( var i = 0; i < data.length; i++) {
	                /* alert(data[i].buildName); */
	               	addOption = "<option value='" + data[i].buildId + "'>" + data[i].buildName + "</option>";
	                $("#buildId").append(addOption);
	            }
			}
		});
	}
	
	function changeUnit(){
		$("#unitId").empty();
		var buildId = $("#buildId").find("option:selected").val();
		/* alert(projectId); */ 
		 $.ajax({
			url:"selectUnit.do",
			type:'post',
			data:{buildId:buildId},
			datatype: "json",
			success:function(data){
				for ( var i = 0; i < data.length; i++) {
	                /* alert(data[i].buildName); */
	               	addOption = "<option value='" + data[i].unitId + "'>" + data[i].unitCode + "</option>";
	                $("#unitId").append(addOption);
	            }
			}
		});
	}
    </script>
</body>
</html>
